package net.lahuobao.finance.entity.reccode;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.*;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Where;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.web.system.pojo.base.TSDepart;

/**   
 * @Title: Entity
 * @Description: 推荐码管理
 * @author zhangdaihao
 * @date 2016-08-24 18:11:05
 * @version V1.0   
 *
 */
@Entity
@Table(name = "t_s_rec_code", schema = "")
@DynamicUpdate(true)
@DynamicInsert(true)
@SuppressWarnings("serial")
public class ReccodeEntity implements java.io.Serializable {

	/**序号*/
	/**@Excel(name = "序号")**/
	private String id;
	/**推荐码持有者*/
	@Excel(name = "用户登录名")
	private String holder;

	/**推荐码持有人类型*/
	private Integer holdertype;
	/**推荐码*/
	@Excel(name = "推荐码")
	private String recCode;
	/**创建时间*/
	private Date createtime;

	@Excel(name = "创建时间")
	private String showCreateTime;//用来显示时间 没什么意义
	/**描述*/
	private String remarks;

	private int				status;


	private TSDepart tsDepart;

	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  序号
	 */
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name ="ID",nullable=false,length=36)
	public String getId(){
		return this.id;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  序号
	 */
	public void setId(String id){
		this.id = id;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  推荐码持有者
	 */
	@Column(name ="HOLDER",nullable=false,length=36)
	public String getHolder(){
		return this.holder;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  推荐码持有者
	 */
	public void setHolder(String holder){
		this.holder = holder;
	}
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  推荐码持有人类型
	 */
	@Column(name ="HOLDERTYPE",nullable=true,precision=10,scale=0)
	public Integer getHoldertype(){
		return this.holdertype;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  推荐码持有人类型
	 */
	public void setHoldertype(Integer holdertype){
		this.holdertype = holdertype;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  推荐码
	 */
	@Column(name ="REC_CODE",nullable=false,length=7)
	public String getRecCode(){
		return this.recCode;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  推荐码
	 */
	public void setRecCode(String recCode){
		this.recCode = recCode;
	}

	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  创建时间
	 */
	@Column(name ="CREATETIME",nullable=false)
	public Date getCreatetime(){
		return this.createtime;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  创建时间
	 */
	public void setCreatetime(Date createtime){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		this.showCreateTime = sdf.format(createtime);
		this.createtime = createtime;
	}


	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  描述
	 */
	@Column(name ="remarks",nullable=false,length=256)
	public String getRemarks(){
		return this.remarks;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  描述
	 */
	public void setRemarks(String remarks){
		this.remarks = remarks;
	}

	@Transient
	public String getShowCreateTime() {
		return showCreateTime;
	}

	public void setShowCreateTime(String showCreateTime) {
		this.showCreateTime = showCreateTime;
	}


	@OneToOne(cascade = CascadeType.ALL,optional = true,fetch = FetchType.LAZY)
	@JoinColumn(name = "holder",insertable = false, updatable = false,nullable = true)
	@Where(clause = "holdertype = '0'")
	public TSDepart getTsDepart() {
		return tsDepart;
	}

	public void setTsDepart(TSDepart tsDepart) {
		this.tsDepart = tsDepart;
	}


	@Column(name = "status")
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
}
